#include "ParticleSignalLine0.h"

#include "ParticleContext.h"
#include "DescriptorParticle.h"

#//include "StreamBinary.h"

using namespace ParticleEngine; 

const DescriptorParticle ParticleSignalLine0::Descriptor
(
	"SignalLine0", 
	[](ParticleContext& NewContext) { return new ParticleSignalLine0(NewContext); }
); 

ParticleSignalLine0::ParticleSignalLine0(ParticleContext& NewContext) :
ParticleBase(NewContext, &ParticleSignalLine0::Descriptor),
	PropertyAdhesions(0.15f),
	Heat(0.5f)
{
	this->Adhesions = dynamic_cast<PropertyAdhesions*>(this);
	this->Adhesions->ParticleCast = dynamic_cast<ParticleBase*>(this);
}
ParticleSignalLine0::~ParticleSignalLine0()
{
}

void ParticleSignalLine0::Sole()//einzelne aktualisierzung
{
	this->SoleStandard();

	this->Heat.Sole();
	this->Signal0.Sole();
}
void ParticleSignalLine0::InteractionIndividual(ParticleBase*const Other, Vec<2, float>& Space, const float& DistanceSquared)
{
	this->InteractionKinetics(Other, Space, DistanceSquared);

	this->Heat.Interaction(Other->HasHeat());
	this->Signal0.Interaction(Other->HasSignal0());
}

ColorRGBA<unsigned char> ParticleSignalLine0::GetColor()
{
	switch (Signal0.Current)
	{
	case SignalStatus::Awaiting:
		return ColorRGBA<unsigned char> (150, 50, 50, 255);
		break;

	case SignalStatus::Active:
		return ColorRGBA<unsigned char> (255, 50, 50, 255);
		break;

	case SignalStatus::Inactive:
		return ColorRGBA<unsigned char> (70, 10, 10, 255);
		break;
	};
	return ColorRGBA<unsigned char> (255, 255, 255, 255);
}



void ParticleSignalLine0::SaveIndividual(std::ofstream& Strm)
{
	Heat.Save(Strm);
	Signal0.Save(Strm);
}
void ParticleSignalLine0::LoadIndividual(std::ifstream& Strm)
{
	Heat.Load(Strm);
	Signal0.Load(Strm);
}


